package com.navigation.action;

import java.util.Map;

import com.navigation.action.base.BaseAction;
import com.navigation.model.User;
import com.opensymphony.xwork2.ActionContext;

public class LoginAction extends BaseAction {

	private String name;
	
	private String pass;
	
	
	@Override
	public String execute() throws Exception{
		Map session=ActionContext.getContext().getSession();
		
		User u=mgr.loginValid(name, pass);
		if(u!=null){
			 session.put("na_user", u);
			 return SUCCESS;
		}
		else{
	       addActionError("用户名/密码不匹配");
		}
		return "failure";
		
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getPass() {
		return pass;
	}


	public void setPass(String pass) {
		this.pass = pass;
	}
}
